package com.lucher.mes.controller;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lucher.mes.common.ConfigUtil;
import com.lucher.mes.common.Tools;
import com.lucher.mes.dao.PrisonerMapper;
import com.lucher.mes.dao.ProduceinfoMapper;
import com.lucher.mes.dao.ProduceproductMapper;
import com.lucher.mes.dao.ProducescheduleMapper;
import com.lucher.mes.dao.ProducescheduleproblemMapper;
import com.lucher.mes.dao.ProductworkorderMapper;
import com.lucher.mes.dao.WorklineMapper;
import com.lucher.mes.dao.WorklinesectionmachineMapper;
import com.lucher.mes.dao.WorkmachineloginMapper;
import com.lucher.mes.dao.WorkorderMapper;
import com.lucher.mes.dao.WorksectionMapper;
import com.lucher.mes.po.Prisoner;
import com.lucher.mes.po.Produceinfo;
import com.lucher.mes.po.Produceproduct;
import com.lucher.mes.po.Produceschedule;
import com.lucher.mes.po.Producescheduleproblem;
import com.lucher.mes.po.Productworkorder;
import com.lucher.mes.po.Workline;
import com.lucher.mes.po.Worklinesectionmachine;
import com.lucher.mes.po.Workmachinelogin;
import com.lucher.mes.po.Workorder;
import com.lucher.mes.po.Worksection;

/**
 * 用户控制层
 */
@Controller
@Scope("prototype")
@RequestMapping("/httpForMachine")
@Transactional
public class HttpForMachineController extends BaseController {

	@Autowired
	private PrisonerMapper prisonerDao;
	@Autowired
	private WorklinesectionmachineMapper worklinesectionmachineDao;
	@Autowired
	private WorklineMapper worklineDao;
	@Autowired
	private WorksectionMapper worksectionDao;
	@Autowired
	private ProduceinfoMapper produceinfoDao;
	@Autowired
	private ProduceproductMapper produceproductDao;
	@Autowired
	private WorkmachineloginMapper workmachineloginDao;
	@Autowired
	private ProducescheduleproblemMapper producescheduleproblemDao;

	@Autowired
	private ProducescheduleMapper producesheduleDao;
	@Autowired
	private ProductworkorderMapper productworkorderDao;
	@Autowired
	private WorkorderMapper workorderDao;
	
	/*
     * 特殊的instance变量
     * 注：零长度的byte数组对象创建起来将比任何对象都经济――查看编译后的字节码：
     * 生成零长度的byte[]对象只需3条操作码，而Object lock = new Object()则需要7行操作码。
     */
    private static byte[] lock = new byte[0];   
	
    
    @ResponseBody
	@RequestMapping(value = "/commServer", produces = "application/json;charset=GBK")
	// 销售服务器请求总接口
	// http://localhost:8080/shenfu/httpForMachine/commServerForMPS?methodname=?&parajson={}
	public Object commServer(HttpServletRequest request) {
    	ObjectMapper mapper = new ObjectMapper();
		Map<String, Object> responseMap = new HashMap<String, Object>();
		String parajson = Tools.getStr(request.getParameter("parajson"));
		JSONObject jsonObj = null;
		try{
			jsonObj = new JSONObject(parajson);
			String method = Tools.getStr(jsonObj.getString("method"));
			if("userLogin".equals(method)){//工位机密码登录
				/***************** 封装userbusiness主表 ******************/
				return saveUserLogin(jsonObj);
			}else if("nfcidpost".equals(method)){//NFC卡绑定
				/***************** 封装userbusiness主表 ******************/
				return saveNfcidpost(jsonObj);
			}else if("nfcidclean".equals(method)){//清楚NFC卡绑定
				/***************** 封装userbusiness主表 ******************/
				return saveNfcidClean(jsonObj);
			}else if("getQcdata".equals(method)){//获取质检数据
				/***************** 封装userbusiness主表 ******************/
				return getQcdata(jsonObj);
			}else if("getMouthReport".equals(method)){
				//新增 Mrxia  查询当月工位机登录人员报表
				return getMouthReport(jsonObj);
			}



			else{
				responseMap.put("status", "0");//-请输入正确的请求格式
				responseMap.put("result", "请输入正确的请求方法名称");
				return mapper.writeValueAsString(responseMap);
			}
		}catch(Exception e){
			e.printStackTrace();
			responseMap.put("status", "0");//-请输入正确的JSON请求格式
			responseMap.put("result", "请输入正确的JSON请求格式");//-
			return responseMap.toString();
		}
	}


	// 操作员登录
	// http://115.159.71.126:8080/shenfu/httpForMachine/commServerForSaleMPS?methodname=operatorLogin&parajson={"user_phone":"123456789","password":"123456"}
	public Map<String, Object> pushPrisonList(JSONObject jsonObj) {
		Map<String, Object> responseMap = new HashMap<String, Object>();
		responseMap.put("status", "1");
		
		String addtime = Tools.getCurrentTime();
		// 判断是否单点登录（不允许同一个操作员登录同时在俩个客户端在线）
		String prisoner_password = ConfigUtil.getConfigFilePath("prisoner_password", "system.properties");
		
		//依次增加新的仓位
		ArrayList<Prisoner> prisonerList = new ArrayList<Prisoner>();
		//合同信号列表
		JSONArray prisonerJSONList = jsonObj.getJSONArray("prisonlist");
		if(prisonerJSONList != null){
			for (int i = 0; i < prisonerJSONList.length(); i++) {
				JSONObject prisonerObject = prisonerJSONList.getJSONObject(i);
				Prisoner prisoner  = new Prisoner();
				prisoner.setAddtime(addtime);
				prisoner.setStatus("入狱");
				prisoner.setPassword(prisoner_password);
				prisoner.setPrisonercode(Tools.getStr(prisonerObject.getString("prisonercode")));
				prisoner.setPrisonername(Tools.getStr(prisonerObject.getString("prisonername")));
				prisoner.setCrimename(Tools.getStr(prisonerObject.getString("crimename")));
				prisoner.setNation(Tools.getStr(prisonerObject.getString("nation")));
				prisoner.setNativeplace(Tools.getStr(prisonerObject.getString("nativeplace")));
				prisoner.setAge(Tools.getStr(prisonerObject.getString("age")));
				prisoner.setPrisonterm(Tools.getStr(prisonerObject.getString("prisonterm")));
				prisoner.setLeftprisonterm(Tools.getStr(prisonerObject.getString("leftprisonterm")));
				prisoner.setMajorcriminals(Tools.getStr(prisonerObject.getString("majorcriminals")));
				prisoner.setPrisonlevel(Tools.getStr(prisonerObject.getString("prisonlevel")));
				prisoner.setPrisontime(Tools.getStr(prisonerObject.getString("prisontime")));
				prisoner.setHeadfilepath(Tools.getStr(prisonerObject.getString("headfilepath")));
				prisoner.setFingerfilepath(Tools.getStr(prisonerObject.getString("fingerfilepath")));
				prisonerList.add(prisoner);
			}
			
			prisonerDao.saveBatch(prisonerList);
			
			responseMap.put("status", "1");//保存失败
			responseMap.put("result", "操作成功");//上传合同失败
			return responseMap;
			
		} else {
			responseMap.put("status", "0");//
			responseMap.put("result", "操作为空");//
		}
		
		
		return responseMap;
	}

	// 操作员登录
	// http://115.159.71.126:8080/shenfu/httpForMachine/commServerForSaleMPS?methodname=operatorLogin&parajson={"user_phone":"123456789","password":"123456"}
	public String saveUserLogin(JSONObject jsonObj) throws JsonProcessingException {
		ObjectMapper mapper = new ObjectMapper();
		Map<String, Object> responseMap = new HashMap<String, Object>();
		responseMap.put("status", "1");
		String prisonercode = Tools.getStr(jsonObj.getString("prisonercode"));
		String password = Tools.getStr(jsonObj.getString("password"));
		String machinecode = Tools.getStr(jsonObj.getString("machinecode"));
		//封装登录信息
		Prisoner record = new Prisoner();
		record.setPrisonercode(prisonercode);
		Prisoner prisoner = prisonerDao.findPrisonerByPrisonercode(record);
		
		if(prisoner == null){
			responseMap.put("status", "0");//
			responseMap.put("result", "登录账号错误");//
			return mapper.writeValueAsString(responseMap);
		}
		
		if(!password.equals(prisoner.getPassword())){
			responseMap.put("status", "0");//登录密码错误
			responseMap.put("result", "登录密码错误");//
			return mapper.writeValueAsString(responseMap);
		}
		
		//查询工位机
		Worklinesectionmachine relation = worklinesectionmachineDao.findByMachinecode(machinecode);
		if(relation == null){
			responseMap.put("status", "0");//
			responseMap.put("result", "该工位机未在产线上");//
			return mapper.writeValueAsString(responseMap);
		}
		
		Workline line = worklineDao.findByCode(relation.getLinecode());
		if(line == null){
			responseMap.put("status", "0");//
			responseMap.put("result", "该生产线不存在");//
			return mapper.writeValueAsString(responseMap);
		}
		
		Worksection section = worksectionDao.findByCode(relation.getSectioncode());
		if(section == null){
			responseMap.put("status", "0");//
			responseMap.put("result", "该工段不存在");//
			return mapper.writeValueAsString(responseMap);
		}
		
		//保存工位机登录信息
		Workmachinelogin workmachinelogin = new Workmachinelogin();
		workmachinelogin.setMachinecode(machinecode);
		workmachinelogin.setPrisonercode(prisonercode);
		workmachinelogin.setPrisonername(prisoner.getPrisonername());
		workmachinelogin.setAddtime(Tools.getCurrentTime());
		workmachineloginDao.insertSelective(workmachinelogin);
		
		responseMap.put("status", "1");//登录成功
		// 封装用户信息
		HashMap<String, Object> employeeMap = new HashMap<String, Object>();
		employeeMap.put("prisonname", Tools.getStr(prisoner.getPrisonername()));
		employeeMap.put("prisonercode", Tools.getStr(prisoner.getPrisonercode()));
		employeeMap.put("headfilepath", Tools.getStr(prisoner.getHeadfilepath()));
		employeeMap.put("fingerfilepath", Tools.getStr(prisoner.getFingerfilepath()));
		employeeMap.put("linecode", Tools.getStr(line.getCode()));
		employeeMap.put("linname", Tools.getStr(line.getName()));
		employeeMap.put("sectioncode", Tools.getStr(section.getCode()));
		employeeMap.put("sectionname", Tools.getStr(section.getName()));
		employeeMap.put("videofilepath", "");
		
		//查询查询该工位机上正在上线的生产任务
		Produceinfo produceinfo = produceinfoDao.findByLinecode(relation.getLinecode());
		if(produceinfo != null){
			Productworkorder  productworkorder = new Productworkorder();
			productworkorder.setProductcode(produceinfo.getProductcode());
			productworkorder.setSerialnumber(relation.getSerialnumber());
			productworkorder = productworkorderDao.findByProductcodeAndSerialnumber(productworkorder);
			if(productworkorder != null){
				Workorder workorder = workorderDao.findByOrdercode(productworkorder.getOrdercode());
				if(workorder != null){
					employeeMap.put("videofilepath", workorder.getFilepath());
				}
			}
		}
		
		responseMap.put("employeeinfo", employeeMap);
		
		//responseMap.toString();
		
		return mapper.writeValueAsString(responseMap);
	}
	
	/**
	 * 图片下载
	 */
	@RequestMapping(value = "/getImgOrFileDownload")
	public Map<String, Object> getImgOrFileDownload(String filepath,HttpServletResponse response){
		
		if(StringUtils.isEmpty(filepath) || filepath.equals("null")){
			return null;
		}
		
		//门锁图片
        try {
			File excelTemplate = new File(filepath);
			response.reset();
			
			//图片文件，直接在页面显示图片
			//if (Tools.isImage(excelTemplate)) {
			Boolean flag = false;
			if (flag) {
				response.setHeader("Accept-Ranges", "bytes");  
	            response.setHeader("Pragma", "no-cache");  
	            response.setHeader("Cache-Control", "no-cache");  
	            response.setDateHeader("Expires", 0);  
			}else{//非图片文件，先下载
				response.setContentType("application/octet-stream");
				response.addHeader("Content-Length", "" + excelTemplate.length()); // 文件大小
				response.addHeader("Content-Disposition", "attachment;filename=" + Tools.getNowRandomTwo()+"."+Tools.getFilename(filepath));
			}
			
			System.out.println(Tools.getFilename(filepath));
			
			FileInputStream fis = new FileInputStream(excelTemplate);
			OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
			byte[] buffer = new byte[1024 * 1024];
			while (fis.read(buffer) > 0) {
				toClient.write(buffer);
			}
			fis.close();
			toClient.flush();
			toClient.close();
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
    }

	// NFC卡绑定
	public String saveNfcidpost(JSONObject jsonObj) throws JsonProcessingException {
		ObjectMapper mapper = new ObjectMapper();
		Map<String, Object> responseMap = new HashMap<String, Object>();
		responseMap.put("code", "200");
		String machinecode = Tools.getStr(jsonObj.getString("machinecode"));
		String nfcid = Tools.getStr(jsonObj.getString("nfcid"));
		
		//刷新旧的绑定的NFC卡
		Produceproduct oldProduceproduct = produceproductDao.findByNfcid(nfcid);
		if(oldProduceproduct != null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该NFCID已经绑定产品包信息");//
			return mapper.writeValueAsString(responseMap);
		}
		
		//查询工位机
		Worklinesectionmachine relation = worklinesectionmachineDao.findByMachinecode(machinecode);
		if(relation == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该工位机未在产线上");//
			return mapper.writeValueAsString(responseMap);
		}
		
		Workline line = worklineDao.findByCode(relation.getLinecode());
		if(line == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该生产线不存在");//
			return mapper.writeValueAsString(responseMap);
		}
		
		Worksection section = worksectionDao.findByCode(relation.getSectioncode());
		if(section == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该工段不存在");//
			return mapper.writeValueAsString(responseMap);
		}
		
		//查询查询该工位机上正在上线的生产任务
		Produceinfo produceinfo = produceinfoDao.findByLinecode(relation.getLinecode());
		if(produceinfo == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该工位机目前没有正在上线的生产任务");//
			return mapper.writeValueAsString(responseMap);
		}
		System.out.println("----------------------------------------------------------------");
		System.out.println("收到的produceinfo"+produceinfo);

		//查询当前任务的分包数
		Integer PackNums	=	produceproductDao.findPackByProducecode( produceinfo.getProducecode() );
 		if(PackNums==0){
			responseMap.put("code", "201");//
			responseMap.put("message", "上线的生产任务还未分包");//
			return mapper.writeValueAsString(responseMap);
		}


		Produceproduct produceproduct = produceproductDao.findOldestPackByProducecode(produceinfo.getProducecode());
		if(produceproduct == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "分包任务已完成");//
			return mapper.writeValueAsString(responseMap);
		}




		
		//绑定NFC卡
		produceproduct.setNfcid(nfcid);
		produceproduct.setProductstatus("生产中");
		produceproductDao.updateByPrimaryKeySelective(produceproduct);
		
		responseMap.put("code", "200");//登录成功
		responseMap.put("message", "绑定成功");//
		
		return mapper.writeValueAsString(responseMap);
	}
	
	// 清空NFC卡绑定
	public String saveNfcidClean(JSONObject jsonObj) throws JsonProcessingException {
		ObjectMapper mapper = new ObjectMapper();
		Map<String, Object> responseMap = new HashMap<String, Object>();
		//String machinecode = Tools.getStr(jsonObj.getString("machinecode"));
		String nfcid = Tools.getStr(jsonObj.getString("nfcid"));
		
		//刷新旧的绑定的NFC卡
		Produceproduct oldProduceproduct = produceproductDao.findByNfcid(nfcid);
		if(oldProduceproduct != null){
			oldProduceproduct.setNfcid(null);
			produceproductDao.updateByPrimaryKeySelective(oldProduceproduct);
		}
		responseMap.put("code", "200");//登录成功
		responseMap.put("message", "清空成功");//
		return mapper.writeValueAsString(responseMap);
	}
	
	// 获取质检数据
	public String getQcdata(JSONObject jsonObj) throws JsonProcessingException {
		ObjectMapper mapper = new ObjectMapper();
		Map<String, Object> responseMap = new HashMap<String, Object>();
		responseMap.put("code", "200");
		String prisonercode = Tools.getStr(jsonObj.getString("prisonercode"));
		String machinecode  = Tools.getStr(jsonObj.getString("machinecode"));
		
		//当天实际
		String cuurenttime = Tools.getCurrentTime();
		
		//查询登录人员
		Prisoner prisoner = new Prisoner();
		prisoner.setPrisonercode(prisonercode);
		prisoner = prisonerDao.findPrisonerByPrisonercode(prisoner);
		
		if(prisoner == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该人员编号不存在");//
			return mapper.writeValueAsString(responseMap);
		}
		
		//当前正在做的产品数据
		Worklinesectionmachine relation = worklinesectionmachineDao.findByMachinecode(machinecode);
		if(relation == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该工位机未在产线上");//
			return mapper.writeValueAsString(responseMap);
		}
		
		Workline line = worklineDao.findByCode(relation.getLinecode());
		if(line == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "该生产线不存在");//
			return mapper.writeValueAsString(responseMap);
		}

		
		//查询查询该工位机上正在上线的生产任务
		Produceinfo produceinfo = produceinfoDao.findByLinecode(relation.getLinecode());
		if(produceinfo == null){
			responseMap.put("code", "201");//
			responseMap.put("message", "生产任务还未分包");//
			return mapper.writeValueAsString(responseMap);
		}

		
		responseMap.put("code", "200");//登录成功
		responseMap.put("prisonercode", prisonercode);
		responseMap.put("machinecode", machinecode);
		//产线代码
		String linecode = produceinfo.getLinecode();
		String productcode = produceinfo.getProductcode();

		HashMap<String, Object> rankMap = new HashMap<String, Object>();
		
		//查询当天质量问题
		String currenttime  = Tools.getCurrentTimeByFormat("yyyy-MM-dd");
		Producescheduleproblem record = new Producescheduleproblem();
		record.setBegintime(currenttime);
		record.setEndtime(currenttime);
		record.setLinecode(linecode);
		record.setPrisonercode(prisonercode);
		record.setProductcode(productcode);
	 	 //查询用户当前问题数量
		 //int total = producescheduleproblemDao.findByCount(record);

		//排名计算开始 XXQ
		List<Map<String, Object>> rankList = producesheduleDao.getRankList(record);
		int rank=1; //显示排名
 		int zspm=1; //真实排名
		boolean hasRank=false; //是否排名
		String REHGL="0";  //人员合格率
		for (Map<String, Object> item: rankList){
	 	 //当前类人员的合格率
		 String ITHGL = item.get("rank").toString();
		 if( !ITHGL.equals(REHGL) ){
			 REHGL=ITHGL;
			 rank=zspm;
		 	}
		 if( prisonercode.equals( item.get("prisonercode").toString())   ){
			 hasRank=true;
			 break;
		 }
		 zspm++;
	 }
		if(!hasRank){ rank=0; }

		//排名计算结束 XXQ

		rankMap.put("efficiency", "---");     //当日排名
		rankMap.put("quality", String.valueOf(rank));  //当天的问题数  注意 实现显示的是Rank排名
		rankMap.put("total", "---");    //综合排名
		responseMap.put("rank", rankMap);
		
		//查询质量问题
		String[] QC_issue_arr = {};
		int[] QC_num_arr = {};
		List<Producescheduleproblem> ProblemStatList = producescheduleproblemDao.findProblemStatByMachine(record);
		if(ProblemStatList != null && ProblemStatList.size() > 0){
			//质量问题
			QC_issue_arr = new String[ProblemStatList.size()];
			QC_num_arr = new int[ProblemStatList.size()];
			for (int i = 0; i < ProblemStatList.size(); i++) {
				QC_issue_arr[i] = ProblemStatList.get(i).getProblemname();
				QC_num_arr[i] = ProblemStatList.get(i).getDepotamount();
			}
		}
		responseMap.put("QC_issue", QC_issue_arr); 
		responseMap.put("QC_num", QC_num_arr); 

		//当天生产完成量
		Integer completedCount = produceproductDao.findCompletedCountByLinecode(line.getCode());







		if(completedCount == null){
			completedCount= 0;
		}
		//当天之前未完成量
		Integer incompletedCount = produceproductDao.findIncompletedCountByLinecode(line.getCode());
		if(incompletedCount == null){
			incompletedCount= 0;
		}
		//当天报废量
		Integer wastedCount = produceproductDao.findWastedCountByLinecode(line.getCode());
		if(wastedCount == null){
			wastedCount= 0;
		}
		//当天的计划量= 当天生产完成量 + 当天之前未完成量 + 当天报废量
		int planCount = completedCount + incompletedCount + wastedCount;
		
		//当天的生产次数
		Produceschedule produceschedule = new Produceschedule();
		produceschedule.setLinecode(line.getCode());
		produceschedule.setPrisonercode(prisonercode);
		produceschedule.setAddtime(cuurenttime);
		//返工数
		produceschedule.setStatus("不合格");
		int problemCount = producesheduleDao.findProducedCountByPrisonercode(produceschedule);
		HashMap<String, Object> productinfo = new HashMap<String, Object>();
		productinfo.put("model", produceinfo.getProductname());                                     //产品型号名称
		productinfo.put("targetoutput", String.valueOf(planCount));                                 //计划目标产量
		productinfo.put("actualoutput", String.valueOf(completedCount));                            //实际产量
		productinfo.put("returnnum", String.valueOf(problemCount));

	   // XXQ 获取人员当天返工率
		String reworkRate = producesheduleDao.getReworkRate(prisonercode,productcode,linecode);
		System.out.println("reworkRatereworkRatereworkRatereworkRate"+reworkRate);
		if(reworkRate==null || reworkRate.equals(null)){
			productinfo.put("reworkrate", Tools.getPercentage((float)0)); //返工率
		}else{
			float reworkRateFloat = Float.parseFloat(reworkRate);
			productinfo.put("reworkrate", Tools.getPercentage(reworkRateFloat) ); //返工率
		}


		/*
		if(produceCount == 0){
			productinfo.put("reworkrate", Tools.getPercentage((float)0)); //返工率
		}else{
			productinfo.put("reworkrate", Tools.getPercentage((float)problemCount/(float)produceCount)); //返工率
		}

		 */
		responseMap.put("productinfo", productinfo);   
		
        //历史排名
		List<HashMap<String, Object>> efficiencyRecordRankList = new ArrayList<HashMap<String, Object>>();
		responseMap.put("efficiencyRecordRank", efficiencyRecordRankList);   
		
		//质量排名
		List<HashMap<String, Object>> qualityRecordRankList = new ArrayList<HashMap<String, Object>>();
		responseMap.put("qualityRecordRank", qualityRecordRankList);   
		
		//总数排名
		List<HashMap<String, Object>> totalRecordRankList = new ArrayList<HashMap<String, Object>>();
		responseMap.put("totalRecordRank", totalRecordRankList);
		
		return mapper.writeValueAsString(responseMap);
	}




	//查询工位机登录人员的本月数据
	public Map<String, Object> getMouthReport(JSONObject jsonObj) {
		Map<String, Object> responseMap = new HashMap<String, Object>();


		// String prisonercode = Tools.getStr(jsonObj.getString("prisonercode"));
		String prisonercode ="0000000002";


		List< Map<String, Object> > repdata=producesheduleDao.getMouthReoprtByPrisonercode(prisonercode);


		responseMap.put("status", "0");//
		responseMap.put("data",repdata);
		responseMap.put("result", "操作为空");//

		return  responseMap;
	}


}
